package com.goldman.distributed.common.ratelimit.exception;

import com.goldman.http.common.s2s.model.ResponseData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author Bin
 * @date 2023/12/13
 */
@Slf4j
@RestControllerAdvice
@Order(2)
public class RateLimitExceptionInterceptor {
    @ExceptionHandler(RateLimitException.class)
    public ResponseData handleRateLimitException(RateLimitException ex) {
        return ResponseData.failed("request too frequently", "request too frequently");
    }
}
